#ifndef _INGAMESTATE_H_
#define _INGAMESTATE_H_

#include "GameState.hpp"
#include "Singleton.hpp"

class LevelsProgressionBar;
class StatusBar;
class TowerPanel;
class InfosPanel;
class Board;


///////////////////////////////////////////////////////
/// \brief State in which the game is when the player's
///        playing.
///
/// This state can be reached from the menu state.
/// In this state, the game is running.
///
/// \note Singleton class.
///
///////////////////////////////////////////////////////
class InGameState : public GameState, public Singleton<InGameState>
{
    friend class Singleton<InGameState>;

public:
    ///////////////////////////////////////////////////////
    /// \brief Destructor
    ///
    ///////////////////////////////////////////////////////
    ~InGameState ();

    ///////////////////////////////////////////////////////
    /// \brief  Initializes the state.
    ///
    ///////////////////////////////////////////////////////
    virtual void init();

    ///////////////////////////////////////////////////////
    /// \brief Resets the state.
    ///
    ///////////////////////////////////////////////////////
    virtual void reset();

    ///////////////////////////////////////////////////////
    /// \brief Handles the user events.
    ///
    /// - The escape key sents back to the menu.
    ///
    ///////////////////////////////////////////////////////
    virtual void handleEvents();

    ///////////////////////////////////////////////////////
    /// \brief Updates the game content.
    ///
    ///////////////////////////////////////////////////////
    virtual void update();

    ///////////////////////////////////////////////////////
    /// \brief Render the game content.
    ///
    ///////////////////////////////////////////////////////
    virtual void render();

private:
    ///////////////////////////////////////////////////////
    /// \brief Creates the "in game" state from the game
    ///        and its rendering window.
    ///
    /// \param game Game the state must act on.
    /// \param window Window on which the game is rendered.
    ///
    ///////////////////////////////////////////////////////
    InGameState(Game* game, sf::RenderWindow* window);

    virtual void loadTextures() const;
    virtual void loadTexture(sf::Texture* texture,
                             const std::string& fileName,
                             const std::string& textureName) const;

    virtual void loadSprites() const;

    LevelsProgressionBar* levelsProgressionBar_;        ///< Level progression bar
    StatusBar* statusBar_;                              ///< Status bar
    TowerPanel* towerPanel_;                            ///< Tower Panel
    InfosPanel* infosPanel_;                            ///< Informartions panel
    Board* board_;                                      ///< Board of the game
};


#endif /* _INGAMESTATE_H_ */
